package us.mooresr.geartrack.shared.model;

import java.io.Serializable;

import javax.persistence.Id;
import javax.persistence.PrePersist;

import com.googlecode.objectify.annotation.Entity;

@Entity
public class DatastoreObject implements Serializable {
	private static final long serialVersionUID = 1600525589524688642L;
	@Id 
	private Long id;
	private Integer version = 0;
	private String name;

	/**
	 * Auto-increment version # whenever persisted
	 */

	@PrePersist
	void onPersist()
	{
		this.version++;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String toString() {
		return this.name;
	}

}
